<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta
            content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
            name='viewport'>
    <link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32"/>
    <link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16"/>
    <title>系统首页</title>
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script type="text/javascript"  src="http://www.ijquery.cn/js/html5shiv.js"></script>
    <![endif]-->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="js/jquery-1.12.4.min.js">\x3C/script>')</script>
    <!--也可以用yepnopejs 加载器;直接是window对象-->
    <!--Font Awesome  一套绝佳的图标字体库和CSS框架 无需依赖JavaScript 无限缩放  完全免费 jquery-confirm里面用到 官网http://fontawesome.dashgame.com/-->
    <link href="css/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="css/bootstrap-3.2.0/css/bootstrap.css"/>
    <link rel="stylesheet" href="css/navigate.css"/>
    <link href="js/nice-validator/jquery.validator.css" rel="stylesheet"
          type="text/css"/>
    <link href="js/jquery-confirm/jquery-confirm.css" rel="stylesheet" type="text/css" />
    <script src="js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/jquery-confirm/jquery-confirm.js"></script>
    <script type="text/javascript" src="js/navigate.js"></script>
    <script type="text/javascript" src="js/jsviews.js"></script>
    <script type="text/javascript" src="js/base.js"></script>
    <script type="text/javascript" src="js/nice-validator/jquery.validator.min.js"></script>
    <script type="text/javascript" src="js/nice-validator/local/zh-CN.js"></script>
    <script type="text/javascript" src="js/layer/layer.js"></script>
    <script type="text/javascript" src="js/base.js" ></script>
    <script type="text/javascript">
        $(document)
            .ready(
                function () {
                    $("#logback").attr("href",
                        root + "j_spring_security_logout");
                    $.ajax({
                        url: root + 'xaCmsUser/showMenu',
                        type: 'get',
                        dataType: 'json',
                        success: function (data) {
                            var menuHtml = $("#nav_menu").render(
                                data.currentMenuData);
                            $("#userName").html(data.currentUser.userName);
                            $("#myUserId").val(data.currentUser.userId);
                            $("#leftNav").append(menuHtml).leftNavMenu({
                                single: true
                            });
                            $('.nav-secnt').on('click', function () {
                                $('.nav-secnt').removeClass('active');
                                $(this).addClass('active');
                            });
                        }
                    });

                    $("#userName").click(function () {
                        $('#validateForm')[0].reset();
                        $("#myModal").modal();
                    });
                    $("#myupdate")
                        .click(
                            function () {
                                $('#validateForm')
                                    .isValid(
                                        function (result) {
                                            if (!result) {
                                                myAlert("还有字段不符合规范，请检查！");
                                                return;
                                            }
                                            var userId = $(
                                                "#myUserId")
                                                .val();
                                            var newPassword = $(
                                                "#newPassword")
                                                .val();
                                            var oldPassword = $(
                                                "#oldPassword")
                                                .val();
                                            $
                                                .ajax({
                                                    url: "xaCmsUser/update/"
                                                    + userId
                                                    + "/"
                                                    + newPassword
                                                    + "/"
                                                    + oldPassword,
                                                    type: 'POST',
                                                    dataType: 'json',
                                                    success: function (data) {
                                                        console
                                                            .log(data);
                                                        if (data.status == 1) {
                                                            myAlert("密码修改成功");
                                                            $(
                                                                '#myModal')
                                                                .modal(
                                                                    'hide');
                                                        } else {
                                                            myAlert(data.result);
                                                        }
                                                    }
                                                });
                                        });

                            });
                });
    </script>
</head>
<body>
<div class="container-fluid pro-body">
    <div class="ti-header">
        <div class="logoClass">e孝道管理系统</div>
        <div align="right" class="ti-info" id="userContent" style="height:100%;line-height:65px;">
            <input type="hidden" id="myUserId" name="myUserId"/>
            <label id="userName" style="cursor: pointer;"></label>：
            <span style="font-size: 14px;margin-right:10px;">欢迎您回来</span>
            <a href="" id="logback" style="color:#fff;">退出</a>&nbsp;&nbsp;&nbsp;&nbsp;
        </div>
    </div>
    <div class="ti-body">
        <div id="leftNav" class="ti-nav-menu"></div>
        <div class="ti-main">
            <div id="ti_panel" class="ti-panel">
                <div class="panel-head">
                    <button type="button" class="btn btn-warning btn-sm ti-return"
                            onclick="closePanel();">
                        <span class="glyphicon glyphicon-backward"></span>返回
                    </button>
                </div>
                <div id="ti_panel_body" class="ti-panel-body">
                    <iframe id="ti_panel_frame" class="ti-body-frame" frameborder="0" scrolling="auto"></iframe>
                </div>
            </div>
            <iframe id="ti_main_frame" class="ti-main-frame" frameborder="0" scrolling="auto"></iframe>
        </div>
    </div>
</div>
<section>
    <!--菜单模板===begin===-->
    <script id="nav_menu" type="text/x-jsrender">
	<div class="nav-tatle">{{:title}}</div>
	{{for items}}
	<div class="nav-line">
		<a class="nav-item"><span class="{{:icon}} nav-tbar"></span>{{:text}}<span class="glyphicon glyphicon-chevron-left nav-bar"></span></a>
		{{if list}}
		<ul>
			{{for list}}
			<li style="background-color: white;"><a class="nav-secnt" href="{{:href}}">{{:text}}</a></li>
			{{/for}}
		</ul>
		{{/if}}
	</div>
	{{/for}}
    <!--<div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">-->
		<!--<i class="ace-icon fa fa-angle-double-left" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>-->
	<!--</div>-->
    </script>
    <!--菜单模板====end====-->
</section>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <form id="validateForm" class="form-horizontal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">修改密码</h4>
                </div>
                <div class="modal-body">
                    <!--						<fieldset>-->
                    <div class="form-group">
                        <label class="control-label col-md-4">旧密码：</label>
                        <div class="controls col-md-5">
                            <input type="password" placeholder="请填写旧密码"
                                   data-rule="旧密码:required;password;" id="oldPassword"
                                   name="oldPassword" class="form-control input-sm"/>
                        </div>
                    </div>
                    <!-- Select Basic -->
                    <div class="form-group">
                        <label class="control-label col-md-4">新密码：</label>
                        <div class="controls col-md-5">
                            <input type="password" placeholder="请填写新密码"
                                   data-rule="新密码:required;password;" id="newPassword" name="newPassword"
                                   class="form-control input-sm"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-4">确认新密码：</label>
                        <div class="controls col-md-5">
                            <input type="password" required="required" id="newpassword1"
                                   data-rule="确认密码:required;password;match(newPassword);"
                                   placeholder="请再次输入新密码" name="newpassword1" class="form-control input-sm"/>
                        </div>
                    </div>
                    <!--						</fieldset>-->
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                    <button type="button" id="myupdate" class="btn btn-primary">
                        确定
                    </button>
                </div>
            </div>
        </div>
    </form>
</div>

</body>
</html>